package com.example.administrator.acmapp.Adapter;

import android.content.Context;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.example.administrator.acmapp.R;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

/**
 * Created by Administrator on 2018/2/5/005.
 */

public class ClassRoomViewPageAdapter extends FragmentPagerAdapter {
    private List<Fragment> mFragmentList;
    private String[] mNavTitleNameArray;
    public void setFragments(ArrayList<Fragment> fragments,String[] titles) {
        mFragmentList = fragments;
        mNavTitleNameArray = titles;
    }
    public ClassRoomViewPageAdapter(FragmentManager fm) {
        super(fm);
    }

    @Override
    public Fragment getItem(int position) {
        return mFragmentList.get(position);
    }

    @Override
    public int getCount() {
        return mFragmentList.size();
    }
    //重写这个方法，将设置每个Tab的标题
    @Override
    public CharSequence getPageTitle(int position) {
        return mNavTitleNameArray[position];
    }
}

